<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <ul>
        <li><a href="#/aaa">aaa</a></li>
        <li><a href="#/bbb">bbb</a></li>
        <li><a href="#/ccc">ccc</a></li>
        <li><a href="#/ddd">ddd</a></li>
    </ul>
    <div id="main"></div>
    <script>
        let oBox = document.getElementById("main");
        window.onhashchange = function () {
            let hash = location.hash
            hash = hash.replace('#/', '');
            switch (hash) {
                case 'aaa':
                    oBox.innerText = 'AAA'
                    break
                case 'bbb':
                    oBox.innerText = 'BBB'
                    break
                case 'ccc':
                    oBox.innerText = 'CCC'
                    break
                case 'ddd':
                    oBox.innerText = 'DDD'
                    break
                default:
            }
        }
    </script>
</body>

</html>